function createArr(...args) {
  let target = [...args];
  let handler = {
    get(target, key, receiver) {
      let index = Number(key);
      if (index < 0) {
        // index = String(target.length + index);
        index = target.length + index;
      }
      return Reflect.get(target, index, receiver);
    },
  };
  return new Proxy(target, handler);
}

var arr1 = createArr(1, 2, 3);
console.log(arr1[-1]);
console.log(arr1[-2]);
